using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;

namespace NetRosApp.Infrastructure.Interface.Base
{
    public partial class ReportZagPodnozje : DevExpress.XtraReports.UI.XtraReport
    {
        public ReportZagPodnozje()
        {
            InitializeComponent();
            try
            {
                //System.Drawing.Imaging.Metafile tmp = new System.Drawing.Imaging.Metafile(@"H:\NetROS\NetRosApp\Slike\Reporti\zaglavlje.wmf");
                System.Drawing.Imaging.Metafile tmp =
                    new System.Drawing.Imaging.Metafile(Application.StartupPath + "\\zaglavlje.wmf");
                int visina = tmp.Size.Height;
                int duzina = tmp.Size.Width;
                if (visina != 0)
                {
                    xrPictureBox2.Height = (int) (((decimal) tmp.Height/(decimal) tmp.Width)*(decimal) 764);
                }
                xrPictureBox2.Image = tmp;
            }
            catch
            {
                try
                {
                 
                        xrRichTextZAG.LoadFile(Application.StartupPath + "\\Zaglavlje.rtf");
                   
                    xrRichTextZAG.Visible = true;
                    xrPictureBox2.Visible = false;
                }
                catch
                {
                    
                }
            }

          
            try
            {
                System.Drawing.Imaging.Metafile tmp2 =
                    new System.Drawing.Imaging.Metafile(Application.StartupPath + "\\podnozje.wmf");
              
                    int visina2 = tmp2.Size.Height;
                    int duzina2 = tmp2.Size.Width;
                    if (visina2 != 0)
                    {
                        xrPictureBox1.Height = (int) (((decimal) tmp2.Height/(decimal) tmp2.Width)*(decimal) 764);
                    }

                    xrPictureBox1.Image = tmp2;
               

            }
            catch
            { try
                {
               
                   
                        xrRichTextPOD.LoadFile(Application.StartupPath + "\\Podnozje.rtf");
                   
                    xrRichTextPOD.Visible = true;
                    xrPictureBox1.Visible = false;
                }
                catch
                {
                    
                }
                
            }
        }
        public ReportZagPodnozje(string pathzaglavlje, string podnozje)
        {
            InitializeComponent();
            try
            {
                //System.Drawing.Imaging.Metafile tmp = new System.Drawing.Imaging.Metafile(@"H:\NetROS\NetRosApp\Slike\Reporti\zaglavlje.wmf");
                if (String.IsNullOrEmpty(pathzaglavlje))
                {
                    pathzaglavlje = "\\zaglavlje.wmf";
                }
                System.Drawing.Imaging.Metafile tmp =
                    new System.Drawing.Imaging.Metafile(Application.StartupPath + pathzaglavlje);
                int visina = tmp.Size.Height;
                int duzina = tmp.Size.Width;
                if (visina != 0)
                {
                    xrPictureBox2.Height = (int)(((decimal)tmp.Height / (decimal)tmp.Width) * (decimal)764);
                }
                xrPictureBox2.Image = tmp;
            }
            catch
            {
                try
                {
               
                    if (pathzaglavlje.Contains("R1"))
                    {
                        xrRichTextZAG.LoadFile(Application.StartupPath + "\\ZaglavljeR1.rtf");
                    }
                    else
                    {
                        xrRichTextZAG.LoadFile(Application.StartupPath + "\\Zaglavlje.rtf");
                    }
                    xrRichTextZAG.Visible = true;
                    xrPictureBox2.Visible = false;
                }
                catch
                {
                    
                }
            }


            try
            {
                 if (String.IsNullOrEmpty(podnozje))
                {
                    podnozje = "\\podnozje.wmf";
                }
                System.Drawing.Imaging.Metafile tmp2 =
                    new System.Drawing.Imaging.Metafile(Application.StartupPath + "\\podnozje.wmf");

                int visina2 = tmp2.Size.Height;
                int duzina2 = tmp2.Size.Width;
                if (visina2 != 0)
                {
                    xrPictureBox1.Height = (int)(((decimal)tmp2.Height / (decimal)tmp2.Width) * (decimal)764);
                }

                xrPictureBox1.Image = tmp2;
             
            }
            catch
            { try
                {
               
                 
                        xrRichTextPOD.LoadFile(Application.StartupPath + "\\Podnozje.rtf");
                 
                    xrRichTextPOD.Visible = true;
                    xrPictureBox1.Visible = false;
                }
                catch
                {
                    
                }

            }

        }
        public ReportZagPodnozje(string pathzaglavlje)
        {
            InitializeComponent();
            try
            {
                //System.Drawing.Imaging.Metafile tmp = new System.Drawing.Imaging.Metafile(@"H:\NetROS\NetRosApp\Slike\Reporti\zaglavlje.wmf");
                if (String.IsNullOrEmpty(pathzaglavlje))
                {
                    pathzaglavlje = "\\zaglavlje.wmf";
                }
                System.Drawing.Imaging.Metafile tmp =
                    new System.Drawing.Imaging.Metafile(Application.StartupPath + pathzaglavlje);
                int visina = tmp.Size.Height;
                int duzina = tmp.Size.Width;
                if (visina != 0)
                {
                    xrPictureBox2.Height = (int)(((decimal)tmp.Height / (decimal)tmp.Width) * (decimal)764);
                }
                xrPictureBox2.Image = tmp;
            }
            catch
            {
                try
                {
                   
                    if (pathzaglavlje.Contains("R1"))
                    {
                        xrRichTextZAG.LoadFile(Application.StartupPath + "\\ZaglavljeR1.rtf");
                    }
                    else
                    {
                        xrRichTextZAG.LoadFile(Application.StartupPath + "\\Zaglavlje.rtf");
                    }
                    xrRichTextZAG.Visible = true;
                    xrPictureBox2.Visible = false;
                }
                catch
                {
                    
                }
            }


            //try
            //{
            //    if (String.IsNullOrEmpty(podnozje))
            //    {
            //        podnozje = "\\podnozje.wmf";
            //    }
            //    System.Drawing.Imaging.Metafile tmp2 =
            //        new System.Drawing.Imaging.Metafile(Application.StartupPath + "\\podnozje.wmf");

            //    int visina2 = tmp2.Size.Height;
            //    int duzina2 = tmp2.Size.Width;
            //    if (visina2 != 0)
            //    {
            //        xrPictureBox1.Height = (int)(((decimal)tmp2.Height / (decimal)tmp2.Width) * (decimal)764);
            //    }

            //    xrPictureBox1.Image = tmp2;

            //}
            //catch
            //{

            //}

        }
    }
}
